package whisper.service.constants;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * Created by JT on 2017/11/2.
 */
@Component
public class MediaInfo {

    @Value("${media.upload.parent.path}")
    private String mediaParentUploadPath;

    @Value("${media.transcode.parent.path}")
    private String mediaParentTranscoePath;

    @Value("${media.temp.parent.path}")
    private String mediaTempParentPath;

    /**
     * 视频文件名前缀
     */
    public static final char MEDIA_FILENAME_PREFIX_UPLOAD = 'U';
    public static final char MEDIA_FILENAME_PREFIX_TARGET = 'T';

    /**
     * 视频文件名后缀
     */
    public static final String MEDIA_FILENAME_SUFFIX_TARGET = "mp4";

    public String getMediaParentUploadPath() {
        return mediaParentUploadPath.endsWith("/") ? mediaParentUploadPath : mediaParentUploadPath + "/";
    }

    public void setMediaParentUploadPath(String mediaParentUploadPath) {
        this.mediaParentUploadPath = mediaParentUploadPath;
    }

    public String getMediaParentTranscoePath() {
        return mediaParentTranscoePath.endsWith("/") ? mediaParentTranscoePath : mediaParentTranscoePath + "/";
    }

    public void setMediaParentTranscoePath(String mediaParentTranscoePath) {
        this.mediaParentTranscoePath = mediaParentTranscoePath;
    }


    public String getMediaTempParentPath() {
        return mediaTempParentPath.endsWith("/") ? mediaTempParentPath : mediaTempParentPath + "/";
    }

    public void setMediaTempParentPath(String mediaTempParentPath) {
        this.mediaTempParentPath = mediaTempParentPath;
    }
}
